package top.zhangjianyong.tools.config.json;

import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.writer.ObjectWriter;

import java.lang.reflect.Type;

/**
 * @author ： zhangjianyong
 * @date ： 2022/8/1 5:01 PM
 */
public class LongToStringSerializer implements ObjectWriter<Long> {


    @Override
    public void write(JSONWriter jsonWriter, Object o, Object o1, Type type, long l) {
        if (o == null) {
            jsonWriter.writeNull();
        } else {
            String strVal = o.toString();
            jsonWriter.writeString(strVal);
        }
    }
}
